package com.qf.main.pharmacy.controller;

import com.qf.common.base.result.ResponseResult;
import com.qf.main.pharmacy.entity.PharmacyClassification;
import com.qf.main.pharmacy.mapper.PharmacyClassificationMapper;
import com.qf.main.pharmacy.service.PharmacyClassificationService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author chengqiang
 * @Create 2024-02-18-22:09
 * @Description:
 */
@RestController
@RequestMapping("/pharmacy/classification")
@CrossOrigin
@Api(tags = "库存管理")
public class PharmacyClassificationController {
    @Resource
    private PharmacyClassificationService pharmacyClassificationService;
    @GetMapping("/list")
    public ResponseResult<List<PharmacyClassification>> getPharmacyClassificationList(){
        return ResponseResult.success(pharmacyClassificationService.getPharmacyClassification());
    }
    @PostMapping("/save")
    public ResponseResult<Integer> savePharmacyClassification(@RequestBody PharmacyClassification pharmacyClassification){
        return ResponseResult.success(pharmacyClassificationService.savePharmacyClassification(pharmacyClassification));
    }

    @DeleteMapping("/edit")
    public ResponseResult<Integer> editPharmacyClassification(@RequestParam int id){
        return ResponseResult.success(pharmacyClassificationService.removePharmacyClassification(id));
    }

    @PutMapping("/erase")
    public ResponseResult<Integer> erasePharmacyClassification(@RequestBody PharmacyClassification pharmacyClassification){
        return ResponseResult.success(pharmacyClassificationService.modifyPharmacyClassification(pharmacyClassification));
    }
}
